using System;
using System.Globalization;
using GammaJul.ReSharper.GammaXaml.Highlightings.CSharp;
using JetBrains.ReSharper.Feature.Services.Bulbs;
using JetBrains.ReSharper.Intentions.Extensibility;
using JetBrains.ReSharper.Intentions.QuickFixes.Naming;

namespace GammaJul.ReSharper.GammaXaml.QuickFixes.CSharp {

	/// <summary>
	/// Quick fix that renames a dependency property field to match its property name.
	/// </summary>
	[QuickFix]
	public sealed class RenameDpFieldFix : ChangeNameFix, IBulbAction {
		private readonly MismatchedDpNameHighlighting _highlighting;

		public new string Text {
			get {
				return String.Format(
					CultureInfo.CurrentCulture,
					"Rename '{0}' to '{1}'",
					_highlighting.DpField.ShortName,
					_highlighting.SuggestedName);
			}
		}

		public RenameDpFieldFix(MismatchedDpNameHighlighting highlighting)
			: base(highlighting) {
			_highlighting = highlighting;
		}
	}
}
